import sys

from PyQt6.QtGui import QAction
from PyQt6.QtWidgets import QApplication, QMainWindow, QLabel


class MainWindow(QMainWindow):
    def __init__(self, parent=None):
        super(MainWindow, self).__init__(parent)
        self.setWindowTitle("menubar_init")
        mm = self.menuBar()
        file = mm.addMenu("File")
        edit = mm.addMenu("Edit")
        file.addAction("新建")
        file.addAction("打开")
        fileSave = QAction("退出", self, shortcut='Ctrl+Q', triggered=QApplication.instance().quit)
        file.addAction(fileSave)
        cate = file.addMenu("目录")
        cate.addAction("1")
        cate.addAction("2")
        # 工具栏
        tbar = self.addToolBar("tool")
        newFile = QAction("查找",self)
        newFile2 = QAction("搜索",self)
        tbar.addAction(newFile)
        tbar.addAction(newFile2)

        # 底部状态栏
        self.statusbar = self.statusBar()
        self.statusbar.showMessage("===")
        self.statusbar.addPermanentWidget(QLabel("user"),stretch=0)
        self.statusbar.addPermanentWidget(QLabel("password"),stretch=0)



if __name__ == '__main__':
    app = QApplication(sys.argv)
    main = MainWindow()
    main.show()
    sys.exit(app.exec())
